import React, { Component } from 'react';
import { withRouter, Link } from 'react-router-dom'
import "./Header.less"
class Header extends Component {
    render() {
        // console.log("header组件的props", this.props);
        let { back, register, title } = this.props
        return (
            <div className='header'>
                {/* 返回 */}
                {back ? <div
                    className='back'
                    onClick={() => {
                        this.props.history.go(-1)
                    }}
                >返回</div> : null}
                {/* 中间的内容--路由元信息 */}
                <div className='text'>{title}</div>
                
                {/* 注册 */}
                {register?<Link to="/register" className="register">注册</Link>:null}
              
              
            </div>
        );
    }
}
export default withRouter(Header)

 